//
// Source code recreated from a .class file by IntelliJ IDEA  
// (powered by FernFlower decompiler)dissociation
//

package come.tool.JDialog;

import com.tool.image.ImageMixDeal;
import com.tool.role.RoleData;

import java.math.BigDecimal;
import java.util.Map;

import org.come.Frame.MountJframe;
import org.come.Frame.PartnerJframe;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.PartnerMainJpanel;
import org.come.Jpanel.TestPetJpanel;
import org.come.Jpanel.ZhuJpanel;
import org.come.bean.ConfigureBean;
import org.come.entity.Mount;
import org.come.entity.Pal;
import org.come.entity.RoleSummoning;
import org.come.model.Configure;
import org.come.mouslisten.ChangeMouseSymbolMouslisten;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.ExpIncreaseUntil;
import org.come.until.FormsManagement;
import org.come.until.UserMessUntil;

public class PalAddPetJDialog implements TiShiChuLi {
	public PalAddPetJDialog() {
	}

	public void tipBox(boolean tishi, Object object) {
		if (tishi) {
			if (object instanceof RoleSummoning) {
				RoleSummoning pet = (RoleSummoning)object;
				int petid = Integer.parseInt(pet.getSummoningid());
				if (pet.getPetlock() == 1) {
					ZhuFrame.getZhuJpanel().addPrompt("该召唤兽已加锁，不能分配！！！");
					return;
				}
//				if (pet.getGoods() != null) {
//					ZhuFrame.getZhuJpanel().addPrompt("该召唤兽携带着装备，不可分配！！！");
//					return;
//				}
				if (ZhuJpanel.getPetMount(pet.getSid()) != null) {
					ZhuFrame.getZhuJpanel().addPrompt2("这只召唤兽被管制中，不可分配！！！");
					return;
				}

				if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null && RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(pet.getSid()) == 0) {
					ZhuFrame.getZhuJpanel().addPrompt2("这只召唤兽已在参战中！！！");
					return;
				}
				PartnerMainJpanel mainJpanel = PartnerJframe.getPartnerJframe().getPartnerMainJpanel();
	            if (mainJpanel.getPalDataChooseId() < 0) {
	                ZhuFrame.getZhuJpanel().addPrompt2("请选择一个伙伴");
	                return;
	            }
	            Pal pidGetPal = mainJpanel.pidGetPal(mainJpanel.getPalDataChooseId());
	            if (pidGetPal == null) {
	                return;
	            }
				String sendmes = Agreement.getAgreement().userpalAgreement(pidGetPal.getId() + "|pet|" + pet.getSid());
                SendMessageUntil.toServer(sendmes);
				ChangeMouseSymbolMouslisten.releasePet(pet,false);
				// 数量
				ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
		    	Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
		    	Configure configure = item.get(new BigDecimal(1));
//                TestPetJpanel.getPetnum().setText("召唤兽("+UserMessUntil.getPetListTable().size() + "/" + configure.getXdzhssx()+")");
			}
		}
	}
}
